from django.db import models

# Create your models here.

class User(models.Model):
    username = models.CharField(max_length=20)
    password = models.CharField(max_length=80)
    nkiname = models.CharField(max_length=10)
    sex = models.IntegerField(null=True)
    age = models.IntegerField(null=True)
    phone = models.CharField(max_length=14)
    email = models.CharField(max_length=25)
    address = models.CharField(max_length=50)
    pic=models.ImageField(upload_to='cars/')
    # 1 正常  2 禁用   3 注销
    statics = models.IntegerField(default=1)
    addtime = models.DateField(auto_now_add=True)

class GoodsClass(models.Model):
    name = models.CharField(max_length=100)
    pid = models.CharField(max_length=20)
    path = models.CharField(max_length=20)


# 商品数据库
class Goods(models.Model):
    pname = models.CharField(max_length=100)
    pnum = models.CharField(max_length=50)
    pcpu = models.CharField(max_length=20)
    ppx = models.CharField(max_length=80)
    pdianchi = models.CharField(max_length=20)
    ppingmu = models.CharField(max_length=20)
    pfenbian = models.CharField(max_length=20)
# 商品颜色
class GoodsColor(models.Model):
    color = models.CharField(max_length=10)
    imgpath = models.CharField(max_length=500)
    pid = models.ForeignKey(to="Goods")
# 商品配置
class GoodsPeiZhi(models.Model):
    peizhi = models.CharField(max_length=30)
    price = models.IntegerField()
    cid = models.ManyToManyField(to="GoodsColor")


    
    
    
    
    